package com.daur.scwcd.test.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class StartSessionServlet extends HttpServlet {

	private static final long serialVersionUID = -6999515178429785498L;

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		PrintWriter writer = response.getWriter();

		HttpSession session = null;
		session = request.getSession(false);
		writer.println("request.getSession(false) : " + session);

		session = request.getSession(true);
		writer.println("request.getSession(true) : " + session);

		session = request.getSession();
		writer.println("request.getSession() : " + session);

		if (session != null) {
			writer.println("Session started!!!");
		}
	}

}
